package com.classload;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @Author: fxy
 * @Date: 2022/04/11/17:12
 * @Description:
 */
public class HotLoad {
    public static void main(String[] args) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, InterruptedException, InstantiationException {
        String path = "D:\\project\\myproject\\test\\test11-java\\src\\main\\java\\com\\classload\\";

        while (true){
            ClassLoader classLoader = new YunClassLoader(path);
            Class<?> test2 = classLoader.loadClass("Test2");
            Object o = test2.newInstance();
            Method[] methods = test2.getDeclaredMethods();
            methods[0].invoke(o);
            Thread.sleep(3000);
        }
    }

}
